﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
///BKNoticeBLL 的摘要说明
/// </summary>
public class BKNoticeBLL
{
    public List<BKPC> GetALL()
    {
        string key = "BKNoticeBLL:asfhjkashdf";
        var lst = (List<BKPC>)System.Web.HttpContext.Current.Cache[key];
        if (lst != null && lst.Count > 0)
        {
            return lst;
        }
        DAL.YZHBGDAL dal = new DAL.YZHBGDAL();
        DataTable tb = dal.Get板块消息评测();
        lst = new List<BKPC>();
        for (int i = 0; i < tb.Rows.Count; i++)
        {
            DataRow row = tb.Rows[i];
            BKPC c = new BKPC();
            c.block_id = DAL.Tools.GetString(row["block_id"]);
            c.block_id = "00" + c.block_id.Substring(2);
            c.date = DAL.Tools.GetDateTime(row["date"]);
            c.news_id = DAL.Tools.GetLong(row["news_id"]).Value;
            c.title = DAL.Tools.GetString(row["title"]);
            c.contents = DAL.Tools.GetString(row["contents"]);
            lst.Add(c);
        }
        if (lst != null && lst.Count > 0)
        {
            System.Web.HttpContext.Current.Cache.Add(key, lst, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Default, null);
        }
        return lst;
    }
}